﻿using System;
using SW.Lite.Infrastructure.Helpers;
using SW.Lite.Infrastructure.Service;

namespace SW.Lite.Core
{
    public class Initializer
    {
        public static void Initialize()
        {
            #region Master

            ServiceLocator.Instance.RegisterType("Master.Admin",
                Type.GetType("SW.Lite.IDAL.Master.IAdmin, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Master.Admin, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            ServiceLocator.Instance.RegisterType("Master.Button",
                Type.GetType("SW.Lite.IDAL.Master.IButton, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Master.Button, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            ServiceLocator.Instance.RegisterType("Master.Menu",
                Type.GetType("SW.Lite.IDAL.Master.IMenu, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Master.Menu, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            ServiceLocator.Instance.RegisterType("Master.Role",
                Type.GetType("SW.Lite.IDAL.Master.IRole, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Master.Role, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            #endregion

            #region General

            ServiceLocator.Instance.RegisterType("Model",
                Type.GetType("SW.Lite.IDAL.IModel, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Model, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            ServiceLocator.Instance.RegisterType("Field",
                Type.GetType("SW.Lite.IDAL.IField, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Field, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            ServiceLocator.Instance.RegisterType("Column",
                Type.GetType("SW.Lite.IDAL.IColumn, SW.Lite.IDAL"),
                Type.GetType("SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type + ".Column, SW.Lite.DAL." + ConfigHelper.Instance.Connection.Type));

            #endregion
        }
    }
}